/*
 *	This file is part of Lounge-Cast.
 *
 *  Author:  	Markus Moormann
 *	E-mail:  	mmoorman@uni-osnabrueck.de
 *	Copyright:	University of Osnabrueck (Zentrum Virtuos)
 * 	Website:	www.uni-osnabrueck.de
 *	Date:		16.02.2011
 *
 *	Lounge-Cast is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *	Lounge-Cast is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Lounge-Cast.  If not, see <http://www.gnu.org/licenses/>.
 */
package org.osmf.elements
{
	import flash.display.DisplayObject;
	import flash.events.EventDispatcher;
	
	import multimedia.model.ModelLocator;
	import multimedia.model.vo.SlideStepVO;
	import multimedia.model.vo.SlideVO;
	
	import mx.collections.ArrayCollection;
	
	import org.osmf.elements.DurationElement;
	import org.osmf.elements.ImageElement;
	import org.osmf.elements.ParallelElement;
	import org.osmf.elements.SWFElement;
	import org.osmf.elements.SerialElement;
	import org.osmf.events.LoadEvent;
	import org.osmf.events.MediaElementEvent;
	import org.osmf.events.MediaErrorEvent;
	import org.osmf.layout.LayoutMetadata;
	import org.osmf.layout.LayoutMode;
	import org.osmf.media.URLResource;
	import org.osmf.traits.DisplayObjectTrait;
	import org.osmf.traits.LoadState;
	import org.osmf.traits.LoadTrait;
	import org.osmf.traits.MediaTraitType;
	
	public class SlideElement extends SerialElement
	{
		
		private var _slideURL:String;
		private var _slideSteps:ArrayCollection
		private var _duration:Number;
		private var _totalDuration:Number;
		
		
		private var _loadTrait:LoadTrait;
		
		private var model:ModelLocator = ModelLocator.getInstance();
		
		public function SlideElement(slide:SlideVO)
		{
			this._slideURL = slide.url + "/assets/";
			this._slideSteps = slide.slideSteps;
			this._totalDuration = slide.duration;
			this._duration = _totalDuration / _slideSteps.length;
			
			for(var i:Number = 1; i <= _slideSteps.length; i++)
			{
				addChild(new DurationElement(_duration,
					new SWFElement(new URLResource(_slideURL + "Slide" + i + ".swf"))));
			}
		}
	}
}